
#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setGeometry(QRect(300,150,700,500));//窗口大小
    this->setWindowTitle("打地鼠王源版");//窗口标题
    this->setWindowIcon(QIcon(":/images/images/tubiao.jpg"));//窗口图标

}

MainWindow::~MainWindow()
{
    delete ui;
}
void MainWindow::paintEvent(QPaintEvent *event){
    QPainter painter(this);
    //画游戏的背景
    painter.setPen(Qt::black);
    painter.setBrush(Qt::black);
    painter.drawRect(0,0,700,500);
    painter.drawPixmap(0,0,700,500,QPixmap(":/images/images/back1.jpg"));
}

//游戏界面切换
void MainWindow::on_pushButton_clicked()
{
    this->hide();//主窗口隐藏
    game *configWindow=new game;
    configWindow->show();//游戏窗口跳出

}

